package cc.mrbird.system.controller;

import cc.mrbird.common.annotation.Log;
import cc.mrbird.system.domain.ChartsModel;
import cc.mrbird.system.service.DaliyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.ParseException;


@Controller
public class WorkingHoursController{

    @Autowired
    DaliyService daliyService;

    private Logger log = LoggerFactory.getLogger(this.getClass());

    @Log("获取工时看板信息")
    @RequestMapping("workingHours")
    @RequiresPermissions("workingHours:list")
    public String index() {
        return "system/workingHours/workingHours";
    }


    /**
     * 获取项目信息
     * @return
     */
    @RequestMapping("workingHours1/list")
    @RequiresPermissions("workingHours:list")
    @ResponseBody
    public ChartsModel workingHoursList1() throws ParseException {
        if (daliyService.daliyMessage()==null) {
            return new ChartsModel();
        }
        return daliyService.getChartsModel1();
    }

    /**
     * 获取组别信息
     * @return
     */
    @RequestMapping("workingHours2/list")
    @RequiresPermissions("workingHours:list")
    @ResponseBody
    public ChartsModel workingHoursList2() throws ParseException {
        if (daliyService.daliyMessage()==null) {
            return new ChartsModel();
        }
        return daliyService.getChartsModel2();
    }
}
